<!-- BEGIN PAGE HEADER-->
<?php $this->load->view('partials/breadcrumb.tpl') ?>
<style>
    th,td{
        text-align: center;
    }
</style>
<script type="text/javascript">
    function defConfirm(url) {
        if (!confirm("确定要删除吗？")) {
            return false;
        }
        window.location.href = url;
        return true;
    }

    $(document).ready(function () {
        $("#reset").click(function () {
            $("select").val('');
            $("input[type='text']").val('');
        });
    });
</script>
<div class="row">
    <div class="col-xs-12">
        <!-- Begin: life time stats -->
        <div class="portlet">
            <?= form_open('', Array('class' => 'form-inline', 'role' => 'form')) ?>
            <?= search_form_input('name', filterValue('name'), '车辆编号名称', 'class="form-control input-small"'); ?>
            <?= search_form_input('brand', filterValue('brand'), '车辆品牌', 'class="form-control input-small"'); ?>
            <?= search_form_dropdown('status', array('' => '选择状态...') + MCar::getState(), filterValue('status'), '状态', 'class="form-control input-xs"'); ?>
            <?= search_form_input('shop_number_perpage', filterValue('shop_number_perpage'), '每页显示条数', 'class="form-control input-small"'); ?>
            <div class="input-group input-large date-picker input-daterange" data-date="" data-date-format="yyyy-mm-dd">
                <input type="text" class="form-control" name="return_time_begin"
                       value="<?= filterValue('return_time_begin') ?>" placeholder="归还起始时间" autoComplete="off">
                <span class="input-group-addon">to </span>
                <input type="text" class="form-control" name="return_time_end"
                       value="<?= filterValue('return_time_end') ?>" placeholder="归还结束时间" autoComplete="off">
            </div>
            <button type="button" class="btn default" id="reset">重置条件</button>
            <button type="submit" class="btn green about_search">搜索 <i class="fa fa-search"></i></button>
            <?= form_close() ?>
            <div class="portlet-body">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="table-scrollable">
                            <table class="table table-hover table-bordered table-striped">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>车辆编号名称</th>
                                    <th>车辆品牌</th>
                                    <th>车辆图片</th>
                                    <th>租赁价格（元/天）</th>
                                    <th>车辆小程序码</th>
                                    <th>最近归还时间</th>
                                    <th>创建时间</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php foreach ($list as $v) { ?>
                                    <tr>
                                        <td><?= $v->id ?></td>
                                        <td><?= $v->name ?></td>
                                        <td><?= $v->brand ?></td>
                                        <td>
                                            <img class="img-rounded" style="width: auto;height: 60px;" src="<?= image_url($v->picture) ?>" />
                                        </td>
                                        <td>￥<?= $v->price ?></td>
                                        <td>
                                            <img class="img-rounded" style="width: auto;height: 60px;" src="<?= image_url($v->qr_code) ?>" />
                                        </td>
                                        <td><?= $v->last_return_time?date('Y-m-d H:i:s', $v->last_return_time):'无出租记录' ?></td>
                                        <td><?= date('Y-m-d H:i:s', $v->create_time) ?></td>
                                        <td><?= MCar::getState($v->status) ?></td>
                                        <td>
                                            <div class="btn-group btn-group-solid">
                                                <a href="<?= site_url($thisModule . $thisController . '/edit/' . $v->id) ?>"
                                                   class="btn btn-sm purple <?= $p->edit ? '' : 'disabled' ?>"><i
                                                            class="fa fa-edit"></i> 编辑</a>
                                                <?php if ($p->delete) { ?>
                                                    <a class="btn btn-sm red hide"
                                                       href="javascript:void(defConfirm('<?= site_url($thisModule . $thisController . '/delete/' . $v->id . '/' . $v->update_time) ?>'));"><i
                                                                class="fa fa-trash-o"></i> <?= l('delete') ?></a>
                                                <?php } ?>
                                            </div>
                                        </td>
                                    </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 text-right">
                        <?= $pagination ?>
                    </div>
                </div>
            </div>
        </div>
        <!-- End: life time stats -->
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $('.img-rounded').zoomify();
    });
</script>
